package cn.tj.util;

import java.time.Duration;
import java.time.LocalDateTime;

public class Haha {
    //返回该数距今时间差(/h)
    public long countTimeHours(LocalDateTime time){
        //获取当前时间
        LocalDateTime now = LocalDateTime.now();
        //计算时间差
        Duration between = Duration.between(time, now);
        // 获取小时差
        long seconds = between.toSeconds();
        if (seconds%3600!=0){
            return (seconds/60/60)+1;
        }else{
            return (seconds/60/60);
        }
    }
}
